<template>
	<view class="pb">
		<swiper class="swiper-box" style="height: 300px;">
			<swiper-item v-for="(item ,index) in info.back_images" :key="index" >
				<view class="swiper-item"><image style="width: 100%;height: auto;" mode="widthFix" :src="item"></image></view>
			</swiper-item>
		</swiper>
		<uni-card :is-shadow="true" is-full>
			<uni-title type="h1" :title="info.title" align="center"></uni-title>
			<uni-title class="h5" type="h5" color="#666" :title="info.addr" align="center"></uni-title>
			<view v-html="info.content"></view>
		</uni-card>
		<view class="view-line"></view>
		<uni-card :is-shadow="true" is-full>
			<view v-html="info.company_serve"></view>
		</uni-card>
		<view class="fixed-bottom">
			<uni-popup ref="popup" background-color="#fff">
				<uni-title type="h2" title="微信二维码" align="center"></uni-title>
				<view class="text-center"><image style="width: 50%;height: auto;" mode="widthFix" :src="info.qr_code"></image></view>
				<uni-title type="h2" title="电话联系" align="center"></uni-title>
				<view class="text-center"><text>{{info.company_tell}}</text></view>
				
			</uni-popup>
			<!-- <uni-goods-nav :fill="true" :options="options" :button-group="customButtonGroup" @click="onClickOption" @buttonClick="buttonClick" /> -->
			<view class="p0-8"><button class="default-button-push" @click="buttonClick()">获取二维码咨询</button></view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				options: [{
					icon: 'search',
					text: '查看大图',
					type:'bigimage',
				}],
				customButtonGroup: [
					{ icon: 'shop',text: '二维码咨询', backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)', color: '#333' },
				],
				id:0,
				form:{page:1},
				info:{banner:'',title:'',create_time:'',click_um:0,content:''},
				
				shareinfo:{title:'',img:'',path:''}
			}
		},
		onLoad(options){
			this.id = options.id
			this.onGetInfo()
		},
		methods: {
			onGetInfo(){
				let _this = this
				this.$request_api('applet_api/resources/info/'+_this.id,'GET').then(res => {
					res.data.content = res.data.content.replace(/\<img/gi, '<img style="width:100%;height:auto"');
					res.data.company_serve = res.data.company_serve.replace(/\<img/gi, '<img style="width:100%;height:auto"');
					_this.info = res.data
					_this.info.back_images = JSON.parse(_this.info.back_images)
					
					_this.shareinfo.title = _this.info.title
					_this.shareinfo.img = res.data.log
				}).catch(err => {
					console.log(err)
				})
			},
			onClickOption(e){
				if(e.content.type == 'bigimage'){
					this.$func.bigImage(this.info.company_serve)
				}
			},
			buttonClick(e) {
				this.$refs.popup.open('bottom')
			},
			onLink(url,id){
				uni.navigateTo({
					url: url+"?id="+id
				});
			}
		}
	}
</script>

<style scoped lang="scss">
.content{padding: 15px 15px 100px 15px;}
.fixed-bottom{background-color: #FFF;}
</style>
